import { config } from "@vue/test-utils"

const teacher_classes = {
    'T08076': {
      class: [
        {
            id: '0001',
            name: 'java编程课',
            introduction: '这是一门教Java编程的课程'
        },
        {
            id: '0002',
            name: 'python编程课',
            introduction: '这是一门教python编程的课程'
        }
      ]
    },
    'T05962': {
        class: [
          {
              id: '0003',
              name: 'c语言编程课',
              introduction: '这是一门教cyuyan编程的课程'
          },
          {
              id: '0004',
              name: 'web编程课',
              introduction: '这是一门教web编程的课程'
          }
        ]
      }
  }
const student_classes = {
    '221701336': {
      class: [
        {
            id: '0001',
            name: 'java编程课',
            introduction: '这是一门教Java编程的课程'
        },
        {
            id: '0004',
              name: 'web编程课',
              introduction: '这是一门教web编程的课程'
        }
      ]
    }
  }
const students = [
  {
      s_id: '211035685',
      name: '小白',
      major: '电子信息',
      grade: '2021级',
      college: 'XXX学院'
  },
  {
    s_id: '211035685',
    name: '小白',
    major: '电子信息',
    grade: '2021级',
    college: 'XXX学院'
  },
  {
    s_id: '211035685',
    name: '小白',
    major: '电子信息',
    grade: '2021级',
    college: 'XXX学院'
  }
]

  export default [
    // teacher classes
    // {
    //   url: '/teacher/classesList',
    //   type: 'post',
    //   response: config => {
    //     const { tid } = config.body
    //     const tclasses= teacher_classes[tid].class

    //     // mock error
    //     if (!tclasses) {
    //       return {
    //         code: 401,
    //         message: 'Account and password are incorrect.'
    //       }
    //     }
    //     const result = {
    //       'classes': tclasses
    //     }

    //     return result
    //   }
    // },
    // admin students list
    // {
    //   url: '/admin/studentList',
    //   type: 'post',
    //   response: config => {
    //     return {
    //      students : students
    //    }
    //   }
    // },

    //admin add student
    // {
    //   url: '/admin/student/create',
    //   type: 'post',
    //   response: config => {
    //     const {s_college,s_id, s_name,s_gender, s_major,s_grade} = config.body
    //     console.log('add  student')
    //     var new_students = {
    //       s_id : s_id,
    //       name : s_name,
    //       gender : s_gender,
    //       major : s_major,
    //       grade : s_grade,
    //       college : s_college  
    //     }
    //     students.push(new_students)
    //     return {
    //       code: 200
    //     }
    //   }
    // },
    //admin del student
    // {
    //   url: '/admin/student/del',
    //   type: 'post',
    //   response: config => {
    //     const {s_id} = config.body
    //     console.log('del  student s_id=' + s_id)
    //     for (var index in students) {
    //       if (students[index].s_id == s_id) {
    //         students.splice(index,1)
    //         break
    //       }
    //     }
    //     return {
    //       code: 200
    //     }
    //   }
    // },

    //admin change student
    // {
    //   url: '/admin/student/change',
    //   type: 'post',
    //   response: config => {
    //     const {s_college,s_id, s_name,s_gender, s_major,s_grade} = config.body
    //     var new_students = {
    //       s_id : s_id,
    //       name : s_name,
    //       gender : s_gender,
    //       major : s_major,
    //       grade : s_grade,
    //       college : s_college  
    //     }
    //     console.log('change  student s_id=' + s_id)
    //     for (var index in students) {
    //       if (students[index].s_id == s_id) {
    //         students[index] = new_students
    //         break
    //       }
    //     }
    //     return {
    //       code: 200
    //     }
    //   }
    // },
    // teacher classes
    // {
    //   url: '/teacher/classesList',
    //   type: 'post',
    //   response: config => {
    //     const { tid } = config.body
    //     const tclasses= teacher_classes[tid].class

    //     // mock error
    //     if (!tclasses) {
    //       return {
    //         code: 401,
    //         message: 'Account and password are incorrect.'
    //       }
    //     }
    //     const result = {
    //       'classes': tclasses
    //     }

    //     return result
    //   }
    // },
    // teacher change classes
    // {
    //   url: '/teacher/class/update',
    //   type: 'post',
    //   response: config => {
    //     const { c_id, new_name, new_introduction } = config.body
    //     console.log(c_id + new_name + new_introduction)
    //     for (var teacher in teacher_classes) {
    //       for (var classes in teacher_classes[teacher]) {
    //         for (var item in teacher_classes[teacher][classes]) {
    //           if (teacher_classes[teacher][classes][item].id == c_id) {
    //             teacher_classes[teacher][classes][item].name = new_name
    //             teacher_classes[teacher][classes][item].introduction = new_introduction
    //           }
    //         }
    //       }
    //     }
    //     return {
    //       code: 200
    //     }
    //   }
    // },
    // teacher add classes
    // {
    //   url: '/teacher/class/create',
    //   type: 'post',
    //   response: config => {
    //     const { t_id, c_name, c_introduction } = config.body
    //     var new_class = {
    //       id: Math.random()*100,
    //       name: c_name,
    //       introduction: c_introduction
    //     }
    //     teacher_classes[t_id].class.push(new_class)
    //     return {
    //       code: 200
    //     }
    //   }
    // }
    //teacher get student list
    // {
    //   url: '/teacher/class/student/list',
    //   type: 'post',
    //   response: config => {
    //     const { c_id } = config.body
    //     console.log("class id : " + c_id)
    //     return {
    //       students: students
    //     }
    //   }
    // }
    // // student classes
    // {
    //   url: '/student/classesList',
    //   type: 'post',
    //   response: config => {
    //     const { sid } = config.body
    //     const cclasses= student_classes[sid]

    //     // mock error
    //     if (!cclasses) {
    //       return {
    //         code: 401,
    //         message: 'Account and password are incorrect.'
    //       }
    //     }
    //     const result = {
    //       'classes': cclasses
    //     }

    //     return result
    //   }
    // }

  ]
